import java.awt.event.KeyEvent;


public class SERVER {
    public static void main(String[] args) {
        System.out.println("Server started");
        
        Logger log = new Logger();
        log.syslog("Server started");
        Terminal term = new Terminal();
        Config_reader config = new Config_reader();
        
        
        Udp_node udp = null;
        if(config.Is_UDP_NODE()){
        	udp =new Udp_node( config.UDP_NODE_IN_PORT);
        }
        
        
        
     
       
       byte[] sendData = new byte[1024];	      
	      sendData ="hello".getBytes();

			udp.UDP_send(sendData,"127.0.0.1",9876);


        
//TODO: make thread!!!
			/*
        Webinterface web = new Webinterface();
        web.start();
        
        
        */
			
			
			
			/**TEST  ********************/
        while(true){
        	Packet b = udp.UDP_get();
        	if(b != null){

        		
        		String str = new String(b.Get_data());

				System.out.println("ARDUINO: " + str);
				log.log("ARDUINO: " + str, "noveny.txt");
        	}
        }
        
        /**_______________________________*/
          
        



    }
    
    
    
    
}
